<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        :root, body{
            height: 100%;
        }
        @media screen and (min-width:810px){
            body{
                background-color: skyblue;
            }
        }
        @media screen and (min-width:490px) and (max-width:810px){
            body{
                background-color: violet;
            }
        }
        @media screen and (max-width:490px){
            body{
                background-color: palegreen;
            }
        }

        body{
            display: flex;
            flex-wrap: wrap;
        }
        div{
            height: 100px;
            background-color: purple;
            border: 2px dashed blue;
            box-sizing: border-box;
        }
        @media screen and (orientation:portrait) {
            div{
            width: 33.33%;
            }
        }
        @media screen and (orientation:landscape) {
            div{
            width: 20%;
            }
        }
    </style>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</body>
</html>